<ui:composition
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ice="http://www.icesoft.com/icefaces/component"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets">

    <ice:form rendered="#{orderBackingBean.renderFlights}">
        <ice:outputText value="Availibe flights:" /> 
        <div class="componentBox">
            <ice:dataTable value="#{orderBackingBean.flights}" var="flight" width="100%">
                <ice:column style="text-align: center">
                    <f:facet name="header">
                        <ice:outputText value="Flight ID"/>
                    </f:facet>
                    <ice:outputText value="#{flight.flightId}"/>
                </ice:column>
                <ice:column style="text-align: center">
                    <f:facet name="header">
                        <ice:outputText value="Departure"/>
                    </f:facet>
                    <ice:outputText value="#{flight.fromAirport} #{flight.depTime}"/>
                </ice:column>
                <ice:column style="text-align: center">
                    <f:facet name="header">
                        <ice:outputText value="Arrival"/>
                    </f:facet>
                    <ice:outputText value="#{flight.toAirport} #{flight.arrTime}"/>
                </ice:column>
                <ice:column style="text-align: center">
                    <f:facet name="header">
                        <ice:outputText value="Price"/>
                    </f:facet>
                    <ice:outputText value="#{flight.price}"/>
                </ice:column>
                <ice:column style="text-align: center">
                    <f:facet name="header">
                        <ice:outputText value="Price"/>
                    </f:facet>
                    <ice:commandButton partialSubmit="true" value="Boka flyg" actionListener="#{orderControllerBean.chooseFlight}">
                        <f:attribute name="flight" value="#{flight}" />
                    </ice:commandButton>
                </ice:column>
            </ice:dataTable>
        </div>
    </ice:form>

</ui:composition>
